
var isPalindrome = function(s: string) {
    var notAlphaNumeric = (c: string) => !((c >= 'a' && c <= 'z') || (c >= '0' && c <= '9'))

    var left = 0, right = s.length - 1;
    while (left < right) {
        let leftChar = s[left].toLowerCase()
        if ( notAlphaNumeric( leftChar)) {
            left++
            continue;
        }
        let rightChar = s[right].toLowerCase()
        if ( notAlphaNumeric( rightChar)) {
            right--
            continue;
        }    
        if (leftChar !== rightChar) return false
        left++
        right--
    }
    return true;
};

console.assert( !isPalindrome('0P'))
console.assert( isPalindrome('A man, a plan, a canal: Panama'))
console.assert( !isPalindrome('race a car'))
console.log('The END');